package ru.spbau.database.group3.index;

import java.io.IOException;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Set;

import ru.spbau.database.group3.engine.Column;
import ru.spbau.database.group3.engine.Condition;
import ru.spbau.database.group3.filesAndAccess.HeapFile;
import ru.spbau.database.group3.filesAndAccess.Record;

public abstract class Index implements Serializable {
	
	protected IndexKeyType indexKeyType;
	public final boolean IS_UNIQUE;
	
	public Index(Set<Column> columns, boolean isUnique, List<Column> relationColumns) {
		this.indexKeyType = new IndexKeyType(columns, relationColumns);
		this.IS_UNIQUE = isUnique;
	}
	
	public IndexKeyType getIndexKey() {
		return indexKeyType;
	}
	
	public abstract void insertRecord(Record r) throws IOException;
	
	public abstract Record deleteRecord(Record r) throws IOException;
	
	public abstract Collection<Record> getRecords(Condition c);
	
	public abstract Collection<Record> getRecords(Collection<Condition> c);
}
